package com.edu.controller;

import com.edu.pojo.APIRequest;
import com.edu.pojo.APIResult;
import com.edu.pojo.StateEnum;
import com.edu.pojo.Student;
import com.edu.service.StudentService;
import com.edu.util.RedisClientUtil;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

/**
 * @作者 five-five
 * @创建时间 2021/1/11
 */
@Api(tags = "学生管理相关接口")
@RestController
//@RequestMapping("/stu")
public interface StudentController {

    /**
     * 跳转到首页
     * @return
     */
    @RequestMapping(value = "/", method = RequestMethod.GET)
    public String index();

    /**
     * 跳转至首页，测试下视图解析器(发现不配做视图解析器，也能跑)
     *
     * @return
     */
    @RequestMapping(value = "/front", method = RequestMethod.POST)
    public APIResult<PageInfo<Student>> front(
            @ApiParam(name = "apiRequest", value = "apiRequest")
            @RequestBody APIRequest apiRequest);

    /**
     * map可以不要
     *
     * @return
     */
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    public Object list(
            @ApiParam(name = "apiRequest", value = "apiRequest")
            @RequestBody APIRequest apiRequest);

    /**
     * 根据学生id进行删除
     *
     * @param id
     * @return
     */
    @ApiOperation(value = "根据学生id进行删除", notes = "根据学生id进行删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "学生id", defaultValue = "0")
    })
    @RequestMapping(value = "/del", method = RequestMethod.GET)
    public Object delbyId(@RequestParam(required = true) Integer id);

    /**
     * 批量添加，你给我数量，我给你造
     *
     * @param num
     * @return
     */
    @RequestMapping(value = "/batcheAddStus", method = RequestMethod.GET)
    public Object batcheAddStus(
            @ApiParam(name = "num", value = "增加学生个数", required = true)
            @RequestParam(required = true) Integer num);

    /**
     * 上传文件至ftp服务器
     * @param file
     * @return
     */
    @RequestMapping(value = "uploadFile", method = RequestMethod.POST)
    public APIResult<Boolean> uploadFile(
            @ApiParam(name = "file", value = "传入的文件", required = true)
            @RequestBody(required = true) MultipartFile file);
}
